#ifndef RAYWIDGET_H
#define RAYWIDGET_H

#include <QtOpenGL>
#include <QImage>
#include <QTimeLine>
#include <QPixmap>

#include "renderthread.h"

class RayWidget : public QGLWidget
{
    Q_OBJECT
public:
    RayWidget(QWidget *parent);
    ~RayWidget();

    void paintEvent(QPaintEvent *);

    void saveGLState();
    void restoreGLState();

signals:
    
public slots:
    void draw();
    void updatePixmap(const QImage &image);

private:
    void initScene();

    RenderThread *thread;

    GLuint tile_list;

    QGLFramebufferObject *render_fbo;
    QGLFramebufferObject *texture_fbo;

    QPixmap pixmap;

};


#endif // RAYWIDGET_H
